<template>
  <div class="container">
    <van-list v-model="isloading" :finished="finished" finished-text="已全部展示" @load="onLoad">
      <channel-item v-for="(v,index) in list" :key="index" :item="v" />
      <div class="placeholder"></div>
    </van-list>

  </div>
</template>
<script>
import ChannelItem from './channel-item.vue'
import { getdetail } from '@/api/channel.js'

export default {
  components: {
    ChannelItem
  },
  props: {
    item: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      list: [],
      page: 1,
      pagesize: 10,
      isloading: false,
      finished: false
    }
  },
  created() {},
  methods: {
    async onLoad() {
      const { data: res } = await getdetail(this.item._id, {
        page: this.page,
        pagesize: this.pagesize
      })
      this.list.push(...res)
      this.isloading = false
      if (res.length) {
        this.page++
      } else {
        this.finished = true
      }
    }
  }
}
</script>
<style lang="less" scoped>
</style>
